<template>
  <main>
    <el-button @click="open()"> 打开目录 </el-button> 
    <div className='ctrv' >

    </div>
  </main>
</template>

<script>
import service from "../../common/api.js";
export default {
  data() {
    return {};
  },
  watch: {},

  created() {
    Object.assign(this, { service }); // 一般很少这样操作
    console.log(service, service.get);
    document.addEventListener('paste', this.copy);
  },
  beforeDestroy() {
    document.removeEventListener('paste', this.copy);
  },
  methods:{
    change(e){
        console.log(      e,e.target.value); 
    },
    
    open(){
      service.get("/system/api/open",{})
    },
    async copy(){ 
       var res = await service.get("/system/api/img",{}) 
       let img = document.createElement('img'); img.src = res.src;  
       document.querySelector(".ctrv").innerHTML = img.outerHTML  
    },
  },

};
</script>

<style scoped></style>
